From 5c1ad88137f85caa0774a6e5e8371a4b50067ea7 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 13 Dec 2021 14:44:40 -0500 Subject: [PATCH] builderparser: Be more robust If a document contains no useful content, just say so instead of crashing. --- tools/gtk-builder-tool-simplify.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/gtk-builder-tool-simplify.c b/tools/gtk-builder-tool-simplify.c index bb8e1ebd62..635b6332fa 100644 --- a/tools/gtk-builder-tool-simplify.c +++ b/tools/gtk-builder-tool-simplify.c @@ -2301,6 +2301,12 @@ simplify_file (const char *filename, return FALSE; } + if (data.root == NULL) + { + g_printerr (_("Can't parse “%s”\n"), filename); + return FALSE; + } + data.builder = gtk_builder_new (); if (data.convert3to4) -- 2.30.2